<template>
  <div class="alipay">
    <loading v-if="loading"></loading>
    <div class="form" v-html="content"></div>
  </div>
</template>

<script>
import Loading from './../components/Loading'
export default {
  name: 'alipay',
  components: {
    Loading
  },
  props: {},
  data () {
    return {
      orderId: this.$route.query.orderId,
      content: '',
      loading: true
    }
  },
  computed: {},
  watch: {},
  created () { },
  mounted () {
    this.paySubmit();

  },
  methods: {
    paySubmit () {
      this.axios.post('/pay', {
        orderId: this.orderId,
        orderName: 'Vue 商城开发',
        amount: 0.01,
        payType: 1
      }).then(res => {
        this.content = res.content
        setTimeout(() => {
          document.forms[0].submit()
        }, 100)
      })
    }
  }
}
</script>

<style scoped lang="scss">
</style>
